<html>
<head>
<meta charset="UTF-8">
<title>内部模型输入输出列表</title>
	<link id="easyuiTheme" href="../../static/easyui/themes/bootstrap/easyui.css" rel="stylesheet" type="text/css"/>
	<link href="../../static/easyui/themes/icon.css" rel="stylesheet" type="text/css"/>
	<script src="../../static/easyui/jquery.min.js" type="text/javascript"></script>
	<script src="../../static/easyui/jquery.cookie.js" type="text/javascript"></script>
	<script src="../../static/easyui/ui-theme.js" type="text/javascript"></script>
	<script src="../../static/easyui/jquery.easyui.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../static/easyui/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
	<script src="../../static/plugin/assets/jslib.util.js" type="text/javascript"></script>
	<script src="../../static/plugin/assets/jslib.jquery.ajax.js" type="text/javascript"></script>
	<script src="../../static/plugin/assets/jslib.easyui.util.js" type="text/javascript"></script>
	<script src="../../ffres/dict/all.js" type="text/javascript"></script>
	<link href="../../static/easyui/themes/frameless.css" rel="stylesheet" type="text/css"/>
	<a href="" target="_blank" id="commonLink" name="commonLink"></a>
</head>
<script type="text/javascript">
	var appId = $.getUrlParam('appId');
	var appModelId = $.getUrlParam('appModelId');
	var readonly = $.getUrlParam('readonly');
	readonly = readonly && readonly == 'true';

	function doAdd(){
		JLEUtil.createModalWin('新增', `IsrvInInfoAdd.html?appId=${appId}&appModelId=${appModelId}`);
	}
	
	function doUpdate() {
		var row = $('#dg').datagrid('getSelected');
		if (row) {
			JLEUtil.createModalWin('修改', `IsrvInInfoUpdate.html?appId=${appId}&appModelId=${appModelId}&` + 'recordKeyid=' + row.recordKeyid + '&appModelId=' + row.appModelId + '&paramCode=' + row.paramCode + '&paramName=' + row.paramName + '&ioType=' + row.ioType + '&mustNeed=' + row.mustNeed);
		} else {
			$.messager.alert('提示','请选择一条记录！','info');
		}
	}
	
	function doDelete(){
		var row = $('#dg').datagrid('getSelected');
		if (row) {
			$.messager.confirm('删除提示', '你确定要删除选中的记录?', function(r){
				if (r){
					var jsonData = {
						recordKeyid : row.recordKeyid
					};
					$.restfulDelete('../../api/isrv/inout/info', jsonData, function(data) {
						$.messager.alert('提示','记录删除成功!','info');
						$('#dg').datagrid('reload');
					});
				}
			});
		} else {
			$.messager.alert('提示','请选择一条记录！','info');
		}
	}

	function doView(){
		var row = $('#dg').datagrid('getSelected');
		if (row) {
			JLEUtil.createModalWin('详情',`IsrvInInfoView.html?appId=${appId}` + '&recordKeyid=' + row.recordKeyid);
		} else {
			$.messager.alert('提示','请选择一条记录！','info');
		}
	}	

	function reloadList(){
		$('#dg').datagrid('reload');
		JLEUtil.closewin();
	};

	
	$(function(){
		var ioType = 'I';
		$('#dg').datagrid({
			url : `../../api/isrv/inout/infos`,
			queryParams: {
				ioType: ioType,
				appModelId : appModelId
			}
		})
		if (readonly) {
			$('.readonly-hidden').hide();
		}
	});
</script>
</head>
<body class="easyui-layout">
<div data-options="region:'center',split:false" style="overflow: hidden">
<table id="dg" class="easyui-datagrid" title="" style="width:100%;height:100%"
			data-options="singleSelect:true,collapsible:true,method:'post'"
			toolbar="#tb"
		title="Load Data" 
		rownumbers="true" pagination="true" pageSize="20">
		<thead>
			<tr>
				<th data-options="field:'recordKeyid',resizable:true" hidden="true">记录唯一编号</th>
				<th data-options="field:'appModelId',resizable:true" hidden="true">应用模型标识</th>
				<th data-options="field:'paramFieldCode',resizable:true" >参数字段代码</th>
				<th data-options="field:'paramFieldType',resizable:true"hidden="true" >参数字段类型</th>
				<th data-options="field:'paramFieldName',resizable:true" >参数字段名称</th>
				<th data-options="field:'ioType',resizable:true" formatter="formatter_IO_TYPE" hidden="true">输入输出类型</th>
				<th data-options="field:'mustNeed',resizable:true" formatter="formatter_STD_PUB_YN">是否必需</th>
			</tr>
		</thead>
	</table>
</div>
<div id="tb" style="padding:1px">
	<div style="margin-bottom:2px">
		<a href="javascript:doAdd()" class="easyui-linkbutton readonly-hidden" iconCls="icon-add" plain="true">新增</a>
		<a href="javascript:doUpdate()" class="easyui-linkbutton readonly-hidden" iconCls="icon-edit" plain="true">修改</a>
		<a href="javascript:doDelete()" class="easyui-linkbutton readonly-hidden" iconCls="icon-remove" plain="true">删除</a>
		<a href="javascript:doView()" class="easyui-linkbutton" iconCls="icon-ok" plain="true">查看</a>
	</div>
</div>
</body>
</html>

